const baseURL = 'http://121.41.196.30:7690/';

function request({url,method = 'GET',data} = {}) {
	uni.showLoading({
		title: '加载中'
	})
	return new Promise((resolve, reject) => {
		uni.request({
			url: baseURL + url,
			method,
			data,
			success: (res) => {
				resolve(res.data);
			},
			fail: (err) => {
				uni.showToast({
					title: '网络开小差了',
					duration: 2000
				})
			},
			complete: () => {
				uni.hideLoading()
			}
		})
	})
}
export default request
